home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / prg_casm / snip9611.zip / SNIPKBIO.H < prev    next >
C/C++ Source or Header  |  1996-11-24  |  3KB  |  84 lines

  1. /* +++Date last modified: 23-Nov-1996 */
  2.  
  3. /*
  4. **    SNIPKBIO.H - Snippets header file for keyboard I/O function
  5. */
  6.  
  7. #ifndef SNIPKBIO__H
  8. #define SNIPKBIO__H
  9.  
  10. #include <dos.h>
  11. #include <conio.h>
  12. #include "sniptype.h"
  13. #include "pchwio.h"
  14.  
  15. Boolean_T getYN(char *prompt, int def_ch,             /* Getyn.C        */
  16.                 unsigned timeout);
  17.  
  18. int  IsLeftShift(void);                        /* Isshift.C    */
  19. int  IsRightShift(void);                    /* Isshift.C    */
  20. int  IsShift(void);                        /* Isshift.C    */
  21.  
  22. int  IsLeftAlt(void);                        /* Isshift.C    */
  23. int  IsRightAlt(void);                        /* Isshift.C    */
  24. int  IsAlt(void);                            /* Isshift.C    */
  25.  
  26. int  IsLeftCtl(void);                        /* Isshift.C    */
  27. int  IsRightCtl(void);                        /* Isshift.C    */
  28. int  IsCtl(void);                            /* Isshift.C    */
  29.  
  30. int  IsSysRq(void);                         /* Isshift.C    */
  31. int  timed_getch(int n_seconds);                      /* Timegetc.C    */
  32. int  isxkeybrd(void);                                 /* Isxkbrd.C    */
  33. void setcaps(void);                                   /* Keylocks.C    */
  34. void clrcaps(void);                        /* Keylocks.C    */
  35. void setnumlock(void);                        /* Keylocks.C    */
  36. void clrnumlock(void);                        /* Keylocks.C    */
  37.  
  38. #define     RIGHT_SHIFT     0x0001
  39. #define     LEFT_SHIFT        0x0002
  40.  
  41. #define     EITHER_ALT        0x0008
  42. #define     LEFT_ALT        0x0200
  43.  
  44. #define     EITHER_CTL        0x0004
  45. #define     LEFT_CTL        0x0100
  46.  
  47. #if defined(__OS2__)
  48.  #define    SYSRQ            0x8000
  49. #else    /* assume DOS */
  50.  #define    SYSRQ            0x0400
  51. #endif
  52.  
  53. #ifdef __OS2__
  54.  #define INCL_NOPM
  55.  #define INCL_KBD
  56.  #define INCL_DOSPROCESS    /* for DosSleep() */
  57.  #include <os2.h>
  58.  
  59. KBDINFO setkbmode(void);    /* Change keyboard to binary mode */
  60. void restkbmode(KBDINFO);   /* restore keyboard mode */
  61.                             /* both defined in EXT_KEYS.C */
  62.  
  63. /* 30-Mar-96 - EBB:
  64. ** OS/2 doesn't have a place in memory where information about the last
  65. ** key is held, like DOS does.    All the information about a keystroke is
  66. ** wrapped up into a structure (KBDKEYINFO) returned from OS/2's
  67. ** get-a-key API call, KbdCharIn(), so if you want to query that information
  68. ** at some arbitrary later time, you have to save it somewhere.  I have
  69. ** chosen to use a global variable defined in ISSHIFT.C to do this.  The
  70. ** functions in ISSHIFT.C report the status of the last key stored in that
  71. ** global, which may not be the last key pressed in your program if you're
  72. ** also storing keystrokes elsewhere.
  73. */
  74. extern KBDKEYINFO ki;        /* Holds key info - defined in ISSHIFT.C */
  75.  
  76.  #define peekkey()    (&ki.fsState)
  77. #else    /* !__OS2__ */
  78.  #define key_seg    0x40
  79.  #define key_off    0x17
  80.  #define peekkey()    ((unsigned short FAR*) MK_FP(key_seg, key_off))
  81. #endif
  82.  
  83. #endif /* SNIPKBIO__H */
  84.